package com.lyu.xiaolvshu.user.biz.rpc;

import com.lyu.xiaolvshu.distributed.id.generator.api.DistributedIdGeneratorFeignApi;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Component;

@Component
public class DistributedIdGeneratorRpcService {

    @Resource
    private DistributedIdGeneratorFeignApi distributedIdGeneratorFeignApi;

    /**
     * leaf 号段模式: 小绿书ID业务标识
     */
    private static final String BIZ_TAG_XIAOLVSHU_ID = "leaf-segment-xiaolvshu-id";

    /**
     * Leaf 号段模式：用户 ID 业务标识
     */
    private static final String BIZ_TAG_USER_ID = "leaf-segment-user-id";

    /**
     * 调用分布式ID生成服务生成小绿书ID
     * @return
     */
    public String getXiaolvshuId() {
        return distributedIdGeneratorFeignApi.getSegmentId(BIZ_TAG_XIAOLVSHU_ID);
    }

    /**
     * 调用分布式ID生成服务生成小绿书ID
     * @return
     */
    public String getUserId() {
        return distributedIdGeneratorFeignApi.getSegmentId(BIZ_TAG_USER_ID);
    }
}
